package com.immo.libcommon.utils;

import com.coorchice.library.SuperTextView;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.CountDownTimer;

/**
 * @author Administrator
 * @content 按钮点击倒计时
 * @date 2018/7/30
 */
public class CountTimeUtil extends CountDownTimer {
    private SuperTextView mSuperTextView;

    public CountTimeUtil(long millisInFuture, long countDownInterval, SuperTextView superTextView) {
        super(millisInFuture, countDownInterval);
        this.mSuperTextView = superTextView;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void onTick(long millisUntilFinished) {
        mSuperTextView.setSolid(Color.parseColor("#999999"));
        mSuperTextView.setClickable(false);
        mSuperTextView.setText(millisUntilFinished / 1000 + "S");
    }

    @Override
    public void onFinish() {
        mSuperTextView.setText("重新获取");
        mSuperTextView.setClickable(true);
        mSuperTextView.setSolid(Color.parseColor("#3baeff"));

    }
}
